#include <bits/stdc++.h>
using namespace std;
int n, m, L, V;
int d[100010], a[100010], v[100010];
int p[100010];
int cnt;
int main(){
    freopen("detect.in", "r", stdin);
    freopen("detect.out", "w", stdout);
    cin >> n >> m >> L >> V;
    for(int i = 1; i <= n; i++){
        cin >> d[i] >> v[i] >> a[i];
    }
    for(int i = 1; i <= m; i++){
        cin >> p[i];
    }
    for(int i = 1; i <= n; i++){
        if(d[i] > p[m]){
            continue;
        }
        else{
            if(v[i] <= V){
                cnt++;
            }
            else{
                continue;
            }
        }
    }
    cout << cnt;
    cout << " ";
    cout << cnt - 1;
    return 0;
}
